varying vec3 pos;
varying vec2 texCoord;
uniform sampler2D cloud;
uniform float time;

float module(vec3 a, vec3 b) {
    vec3 c = a - b;
    return sqrt(c.x*c.x + c.y*c.y + c.z*c.z);
}

void main(void) {
    vec4 color = texture2D(cloud,texCoord);
    float fren;
    float fren2;
    if(time < 100.0) fren = 1.0;
    else fren = (time - 84.0)/16.0;
       
    if(time < 70.0) fren2 = 1.0;
    else fren2 = (time - 66.0)/4.0;
    
    color.w /= fren2*1.5;
    float hue = (color.x + color.y + color.z) - time/200.0;
    color.x = 1.0/fren;
    color.y = 0.5/fren*hue;
    color.z = 0.0;
    gl_FragColor = color;
}
